

#ifndef TASK_LCD_H
#define TASK_LCD_H

#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <esp_err.h>
#include <esp_log.h>

#include <atomic>
#include <vector>

#include <driver/i2c_master.h>
#include <esp_lcd_panel_io.h>
#include <esp_lcd_panel_ops.h>
#include <esp_lcd_panel_vendor.h>
#include "lcd_panel_st7735.h"

#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_9
#define DISPLAY_MOSI_PIN      GPIO_NUM_18
#define DISPLAY_CLK_PIN       GPIO_NUM_17
#define DISPLAY_DC_PIN        GPIO_NUM_8
#define DISPLAY_RST_PIN       GPIO_NUM_20
#define DISPLAY_CS_PIN        GPIO_NUM_46

#ifdef CONFIG_LCD_ST7735_128X160
#define LCD_TYPE_ST7789_SERIAL
#define DISPLAY_WIDTH                   128
#define DISPLAY_HEIGHT                  160
#define DISPLAY_MIRROR_X                true
#define DISPLAY_MIRROR_Y                true
#define DISPLAY_SWAP_XY                 false
#define DISPLAY_INVERT_COLOR            false
#define DISPLAY_RGB_ORDER               LCD_RGB_ELEMENT_ORDER_RGB
#define DISPLAY_OFFSET_X                0
#define DISPLAY_OFFSET_Y                0
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false
#define DISPLAY_SPI_MODE                0
#endif

/* ************************************************************************* */
/* ************************************************************************* */
/* ************************************************************************* */

extern esp_lcd_panel_io_handle_t panel_io ;
extern esp_lcd_panel_handle_t    lcd_panel    ;
/* ************************************************************************* */
/* ************************************************************************* */
/* ************************************************************************* */

void task_lcd_init(void);

#endif // TASK_LCD_H
